import * as echarts from 'echarts'
const Bar1Option = ({ yAxisData, dataList }) => {
  let options = {
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        type: 'shadow',
      },
    },
    grid: {
      y: 0,
      x2: 10,
      x: 70,
    },
    xAxis: [
      {
        type: 'value',
        axisLabel: {
          formatter: '{value}',
          color: '#8D93A7',
        },
      },
    ],
    yAxis: [
      {
        type: 'category',
        offset: 5,
        axisTick: {
          show: false,
        },
        axisLine: {
          lineStyle: {
            color: '#D0D7E8',
          },
        },
        axisLabel: {
          formatter: '{value}',
          color: '#8D93A7',
        },
        splitArea: {
          show: true,
        },
        data: yAxisData,
      },
    ],
    series: [
      {
        name: '企业数量',
        type: 'bar',
        stack: 'Total',
        emphasis: {
          focus: 'series',
        },
        data: dataList[0],
        itemStyle: {
          color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [
            {
              offset: 0,
              color: '#C3EBF9',
            }, //柱图渐变色
            {
              offset: 1,
              color: '#18D3FC',
            }, //柱图渐变色
          ]),
        },
      },
      {
        name: '增速',
        type: 'bar',
        stack: 'Total',
        emphasis: {
          focus: 'series',
        },
        barWidth: 6,
        data: dataList[1],
        itemStyle: {
          color: new echarts.graphic.LinearGradient(1, 0, 0, 0, [
            {
              offset: 0,
              color: '#E8E0E8',
            }, //柱图渐变色
            {
              offset: 1,
              color: '#FF6162',
            }, //柱图渐变色
          ]),
        },
      },
    ],
  }
  return options
}

export { Bar1Option }
